//
//  iTrackAnnotation.h
//  iTrack
//
//  Created by Sergei Sevriugin on 6/14/10.
//  Copyright 2010 Bellwood Systems. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>

#import	<MapKit/MapKit.h>
#import	<MapKit/MKOverlay.h>

#import "Clients/Maps/GDataMaps.h"

enum {
		ITAnnotationKindInvalid = 0,
		ITAnnotationKindPoint,
		ITAnnotationKindLine
};

@interface ITAnnotation : NSObject <MKOverlay> {
		
	// MKAnnotation protocol
	NSString*				title;
	NSString*				subtitle;
	
	// MKOverlay protocol
	CLLocationCoordinate2D	coordinate;
	MKMapRect				boundingMapRect;
	
	// Google Map feature
	GDataEntryMapFeature*	feature;
	NSMutableArray*			locations;
	NSInteger				kind;
	
	UIViewController*		mapViewController;	
}

@property (nonatomic, readonly)		CLLocationCoordinate2D	coordinate;
@property (nonatomic, readonly)		MKMapRect				boundingMapRect;

@property (nonatomic, retain)		GDataEntryMapFeature*	feature;
@property (nonatomic, retain)		NSMutableArray*			locations;
@property (nonatomic, assign)		NSInteger				kind;

@property (nonatomic, retain)		UIViewController*		mapViewController;


- (NSString *)title;
- (NSString *)subtitle;
- (void)setCoordinate:(CLLocationCoordinate2D)newCoordinate;

- (void)setMapRect;

- (id) initWithMapFeature:(GDataEntryMapFeature*) mapFeature;
- (id) initWithLocation:(CLLocation*) location andTitle:(NSString*) theTitle;
- (id) initWithLocation:(CLLocation*) location;

- (void) getFeatureParameters;
- (void) saveFeature;

- (void) addLocation:(CLLocation*) location;
- (void) updateLocation:(CLLocation*) newLocation;
- (CLLocation*) getLastLocation;
- (NSString*) locationsToString;

- (void) putOnMap;
- (void) removeFromMap;

-(IBAction)detailClicked:(id)sender;
- (BOOL) isPath;
- (BOOL) isPoint;

@end
